#pragma once

#include <new>
#include "Object_.h"
////////////////////////////////////////////////////////////////////////////////
// class SmallObject
// Base class for polymorphic small objects, offers fast allocations &
//     deallocations.  Destructor is virtual and public.
////////////////////////////////////////////////////////////////////////////////
#pragma warning(disable:4291)

namespace SO
{
class AFX_EXT_CLASS SmallObject : public Object_
{
	UE_DECLARE_DYNAMIC(SmallObject);
    public:
        virtual ~SmallObject() {}
    protected:
        inline SmallObject( void ) {}
		
    public:

        static void * operator new ( size_t size );

        static void * operator new ( size_t size, const std::nothrow_t &t ) throw ();

        static void operator delete ( void * p, size_t size ) throw ();

        static void operator delete ( void * p, size_t size,
            const std::nothrow_t &t ) throw();
#ifdef _DEBUG
		static void * operator new ( size_t nSize, LPCSTR lpszFileName, int nLine );

		static void operator delete ( void * p, size_t size, LPCSTR lpszFileName, int nLine );
#endif
        inline static void operator delete ( void * p, void * place )
        {
            ::operator delete ( p, place );
        }

        inline static void * operator new ( size_t size, void * place )
        {
            return ::operator new( size, place );
        }
    private:
        /// Copy-constructor is not implemented.
        SmallObject( const SmallObject & );
        /// Copy-assignment operator is not implemented.
        SmallObject & operator = ( const SmallObject & );
}; // end class SmallObject
}

////////////////////////////////////////////////////////////////////////////////
// class SmallValueObject
// Base class for small objects with value semantics - offers fast allocations &
//     deallocations.  Destructor is non-virtual, inline, and protected.
////////////////////////////////////////////////////////////////////////////////

namespace SV
{
class AFX_EXT_CLASS SmallValueObject : public Object_
{
	UE_DECLARE_DYNAMIC(SmallValueObject);
    protected:
        inline SmallValueObject( void ) {}
        inline SmallValueObject( const SmallValueObject & ) {}
        inline SmallValueObject & operator = ( const SmallValueObject & ) {return *this;}
        inline ~SmallValueObject() {}

		
    public:

        static void * operator new ( size_t size );

        static void * operator new ( size_t size, const std::nothrow_t &t ) throw ();

        static void operator delete ( void * p, size_t size ) throw ();

        static void operator delete ( void * p, size_t size,
            const std::nothrow_t &t ) throw();
#ifdef _DEBUG
		static void * operator new ( size_t nSize, LPCSTR lpszFileName, int nLine );

		static void operator delete ( void * p, size_t size, LPCSTR lpszFileName, int nLine );
#endif
        inline static void operator delete ( void * p, void * place )
        {
            ::operator delete ( p, place );
        }

        inline static void * operator new ( size_t size, void * place )
        {
            return ::operator new( size, place );
        }
}; // end class SmallValueObject

}

using namespace SO;
using namespace SV;
